<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title><fmt:message code="sms.th.ReceivedReminder" /></title>

	<link rel="stylesheet" type="text/css" href="../../lib/pagination/style/pagination.css"/>
	<link rel="stylesheet" type="text/css" href="../../css/base.css"/>

	<script src="../js/jquery/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/base/base.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../lib/laydate/laydate.js"></script>
	<script src="../../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../lib/laydate/laydate.js"></script>
	<script src="../../lib/layer/layer.js?20201106"></script>

	<style>
		html,body{
			width:100%;
			height:100%;
		}
		.countSpan {
			color: red;
		}

		.contentTableBody {
			text-align: center;
		}

		.detail_a {
			color: dodgerblue;
			cursor: pointer;
		}

		.bottom_a_style {
			cursor: pointer;
			margin-left: 10px;
			color: #404060;
			display: inline-block;
			padding-left: 22px;
			line-height: 25px;
		}

		.headTable tr {
			border: none;
		}

		table {
			width: 98%;
			margin: 0px 1%;
		}

		.contentTable {
			margin-top: 10px;
		}

		.contentTable thead tr {
			height: 50px;
		}

		label {
			cursor: pointer;
		}

		.contentTableBody tr {
			background: #F6F7F9;
		}

		.contentTableBody tr td{
			overflow: hidden;
			text-overflow:ellipsis;
			white-space: nowrap;
		}

		.contentTableBody tr:nth-child(even) {
			background: #ffffff;
		}

		.title_span{
			font-size: 16px;
		}

		.bottom_table{
			margin-top: 20px;
		}
		.bottom_table .first_td{
			background-color: #f2f2f2;
			border-right: 1px #dddddd solid;
			width: 80px;
		}
		.bottom_table a {
			cursor: pointer;
			margin-left: 10px;
			color: #404060;
			display: inline-block;
			padding-left: 22px;
			line-height: 25px;
		}
		.delete_a{
			background: url(../../img/sms/icon_affairremind_delete_12.png) no-repeat;
			background-position-y: 8.2px;
			padding-right: 6px;
			background-size: 17%;
		}
		.delete_allRead{
			background: url(../../img/sms/icon_affairremind_delete_12.png) no-repeat;
			background-position-y: 8.2px;
			padding-right: 6px;
			background-size: 7%;
		}
		.delete_all{
			background: url(../../img/sms/icon_affairremind_delete_12.png) no-repeat;
			background-position-y: 5px;
			padding-right: 6px;
		}
		.remind_a{
			background: url(../../img/sms/icon_readmark_12.png) no-repeat;
			background-position-y: 8.2px;
			padding-right: 4px;
			background-size: 12%;
		}
		.remind_all{
			background: url(../../img/sms/icon_readmarkall_12.png) no-repeat;
			background-position-y: 8.2px;
			padding-right: 4px;
			background-size: 10%;
		}
		.title_span{
			margin-left: 5px;
		}
		.page-top-inner-layer table {
			text-align: left;
		}
		.jianju{
			width: 98%;
			margin: 0 1%;
		}
		.juzuo{
			padding: 10px;
		}
		.pagediv .page-top-inner-layer{
			padding-right: 0 !important;
		}
		.imgDiv{
			text-align: center;
			display: none;
			margin-top: 60px;
		}
		.title_span ~ span{
			font-size: 12px;
		}
	</style>
	<link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>
	<link rel="stylesheet" href="/css/base/base.css?20201106.1">
	<script type="text/javascript" src="/js/base/tablePage.js"></script>
</head>
<body>

<table class="headTable jianju">
	<tr >
		<td class="juzuo"><img width="15px" height="15px" src="/img/commonTheme/${sessionScope.InterfaceModel}/title_received_sms.png" alt=""><span class="title_span"><fmt:message code="sms.th.ReceivedReminder" /></span>&nbsp;&nbsp;<span>(<fmt:message code="main.th.general" /></span><span class="countSpan">0</span><span><fmt:message code="main.th.BarReminder" />)</span></td>
		<td></td>
		<td>
		</td>
	</tr>
</table>
<div class="imgDiv"><img class="noneImg" src="/img/main_img/shouyekong.png" alt="">
	<div>暂无数据</div>
</div>
<%--<table class="contentTable" style="table-layout: fixed; " >--%>
	<%--<thead>--%>
	<%--<tr>--%>
		<%--<th style="width: 9%;text-align:center;padding-left:10px"><fmt:message code="global.lang.select" /></th>--%>
		<%--<th style="width: 16%"><fmt:message code="sup.th.Sender" /></th>--%>
		<%--<th style="width: 15%"><fmt:message code="notice.th.type" /></th>--%>
		<%--<th style="width: 30%"><fmt:message code="notice.th.content" /></th>--%>
		<%--<th style="width: 20%"><fmt:message code="sup.th.SendingTime" /></th>--%>
		<%--<th style="width: 10%"><fmt:message code="notice.th.operation" /></th>--%>
		<%--</tr>--%>
	<%--</thead>--%>
	<%--<tbody class="contentTableBody">--%>

	<%--</tbody>--%>
	<%--</table>--%>

<%--<table class="bottom_table">--%>
	<%--<tr>--%>
		<%--<td class="first_td"><fmt:message code="news.th.Quickoperation" />：</td>--%>
		<%--<td colspan=""><a class="delete_allRead"><fmt:message code="sms.th.DeleteAll" /></a><a class="delete_all"><fmt:message code="meet.th.DeleteAll" /></a><a class="remind_all"><fmt:message code="sms.th.AllMarkedRead" /></a></td>--%>
		<%--</tr>--%>
	<%--</table>--%>

<div id="pagediv" ></div>

<script type="text/javascript">
	<%--使用表格分页插件--%>
	var pageObj=$.tablePage('#pagediv','100%',[
				{
					width:'46px',
					title:'<fmt:message code="global.lang.select" />',
					name:'nulls',
					selectFun:function (name,obj) {

						return '<input type="checkbox" bodyId="'+obj.bodyId+'"/>'
					}
				},
				{
					width:'120px',
					title:'<fmt:message code="sup.th.Sender" />',
					name:'fromName'
				},
				{
					width:'120px',
					title:'<fmt:message code="notice.th.type" />',
					name:'smsTypeName'
				},
				{
					width:'320px',
					title:'<fmt:message code="notice.th.content" />',
					name:'content',
					selectFun:function (name,obj) {
						//console.log(obj.content);
						var special = obj.content;
						var color='#2B7FE0';
						if (special.indexOf("紧急") != -1 || special.indexOf("特急") != -1) {
							color='red'
							// $(".txtContent").css("color","red");
						}
						return '<div class="btnTd" style="color:'+color+';cursor: pointer;" remindUrl="'+obj.remindUrl+'"  bodyId="' + obj.bodyId +' " title="' + obj.content + '">'+obj.content+'</div>'


					}
				},{
					width:'170px',
					title:'<fmt:message code="sup.th.SendingTime" />',
					name:'sendTimeStr'
				},
				{
					width:'120px',
					title:'<div style="padding-left:13px;">操作</div>'
				}
			],function (me) {
				me.data.queryType=2;
				me.data.pageSize=10;
				//1显示  // 2不显示  //不写fn这个属性就是全显示
				me.init('/sms/selectByQueryType',[{name:'查看详情',fn:function (obj) {
						return '<a href="<%=basePath%>'+encodeURI(obj.remindUrl)+'" target="_blank">查看详情</a>'
					}}],function (json) {
					$('.countSpan').html(" " + json.totleNum + " ");
					var str = "<tr class='last_str'>" +
							"<td style='overflow: visible;'><input id='checkedAll' style='float:left; '  type='checkbox' conid='29' name='check' value=''><label for='checkedAll' style='margin-top: 7px;margin-left: 8px;position: relative;top: 3px;'><fmt:message code="notice.th.allchose" /></label></td>" +
					"<td colspan='5' style='text-align: left' class='btnStyle delete_check'><a class='delete_a bottom_a_style' ><fmt:message code="menuSSetting.th.deleteMenu" /></a><a class='remind_a bottom_a_style' ><fmt:message code="sms.th.MarkRead" /></a></td>" +
					"</tr>"+'<tr class="bottom_table"> <td colspan="2" class="first_td"><fmt:message code="news.th.Quickoperation" />：</td> <td colspan="4"><a class="delete_allRead"><fmt:message code="sms.th.DeleteAll" /></a><a class="remind_all"><fmt:message code="sms.th.AllMarkedRead" /></a></td> </tr>';
					$('#operation').html(str);
				})
			}
	)

	$('.Query').click(function () {
		pageObj.data.page=1;
		pageObj.data.fromName=$('[name="fromName"]').val();
		pageObj.data.smsTypeName=$('[name="smsTypeName"]').val()
		pageObj.data.content=$('[name="content"]').val()
		pageObj.data.sendTimeStr=$('[name="sendTimeStr"]').val()
		pageObj.init();
	})
	//点击全选
	$('#pagediv').on('click', '#checkedAll', function () {

		var state = $(this).prop("checked");
		if (state == true) {
			$(this).prop("checked", true);
			$("#pageTbody tr td input").prop("checked", true);
		} else {
			$(this).prop("checked", false);
			$("#pageTbody tr td input").prop("checked", false);
		}
	});

	$(function () {
//        var data = {
//            queryType: 2,
//            page: 1,
//            pageSize: 5,
//            useFlag: true
//        };
//        initPageList(function (pageCount) {
//            initPagination(pageCount, data.pageSize);
//        });

	<%--function initPagination(totalData, pageSize) {--%>
		<%--$('.M-box3').pagination({--%>
				<%--totalData: totalData,--%>
		<%--showData: pageSize,--%>
		<%--jump: true,--%>
		<%--coping: true,--%>
		<%--current: data.page,--%>
		<%--homePage: '<fmt:message code="global.page.first" />',--%>
		<%--endPage: '<fmt:message code="global.page.last" />',--%>
		<%--prevContent: '<fmt:message code="global.page.pre" />',--%>
		<%--nextContent: '<fmt:message code="global.page.next" />',--%>
		<%--jumpBtn: '<fmt:message code="global.page.jump" />',--%>
		<%--callback: function (index) {--%>
		<%--data.page = index.getCurrent();--%>
		<%--initPageList(function (pageCount) {--%>
		<%--initPagination(pageCount, data.pageSize);--%>
		<%--});--%>
		<%--}--%>
		<%--});--%>
		<%--}--%>

		<%--function initPageList(cb) {--%>
		<%--$.ajax({--%>
				<%--type: "get",--%>
		<%--url: "<%=basePath%>sms/selectByQueryType",--%>
		<%--dataType: 'JSON',--%>
		<%--data: data,--%>
		<%--success: function (data) {--%>
		<%--var str = "";--%>

		<%--for (var i = 0; i < data.obj.length; i++) {--%>
		<%--// 格式化时间--%>
		<%--var sendTime = new Date((data.obj[i].sendTime) * 1000).Format('yyyy-MM-dd');--%>
		<%--if (data.obj[i].fromName == undefined) {--%>
		<%--data.obj[i].fromName = "<fmt:message code="sms.th.UserNotExist" />";--%>
		<%--}--%>

		<%--str += "<tr><td style='width: 3em ' ><input class='checkChild' type='checkbox' bodyId='" + data.obj[i].bodyId + "' name='check' value=''></td>" +--%>
				<%--"<td style='width: 5em '>" + data.obj[i].fromName + "</td>" +--%>
				<%--"<td style='width: 4em'>" + data.obj[i].smsTypeName + "</td>" +--%>
				<%--"<td title='"+ data.obj[i].content +"'>" + data.obj[i].content + "</td>" +--%>
				<%--"<td style='width:6em'>" + sendTime + "</td>" +--%>
				<%--"<td><a class='detail_a'  remindUrl='"+data.obj[i].remindUrl+"'  bodyId='" + data.obj[i].bodyId + "' >查看详情</a></td></tr>";--%>
		<%--}--%>

		<%--var last_str = "<tr class='last_str'>" +--%>
				<%--"<td><input id='checkedAll' style='float:left; margin-left: 1rem;'  type='checkbox' conid='29' name='check' value=''><label for='checkedAll' style='float:left;'><fmt:message code="notice.th.allchose" /></label></td>" +--%>
		<%--"<td colspan='5' style='text-align: left' class='btnStyle delete_check'><a class='delete_a bottom_a_style' ><fmt:message code="menuSSetting.th.deleteMenu" /></a><a class='remind_a bottom_a_style' ><fmt:message code="sms.th.MarkRead" /></a></td>" +--%>
		<%--"</tr>";--%>

		<%--if (data.totleNum != undefined) {--%>
		<%--$('.countSpan').html(" " + data.totleNum + " ");--%>
		<%--}--%>
		<%--$(".contentTableBody").html(str + last_str);--%>

		<%--if (data.totleNum == 0) {--%>
		<%--parent.layer.msg("<fmt:message code="sms.th.noData" />");--%>
		<%--}--%>
		<%--if (cb) {--%>
		<%--cb(data.totleNum);--%>
		<%--}--%>

		<%--initPagination(data.totleNum, 5);--%>
		<%--}--%>
		<%--})--%>
		<%--}--%>

		//点击全选
		$('.contentTableBody').on('click', '#checkedAll', function () {
//          alert('111');
			var state = $(this).prop("checked");
			if (state == true) {
				$(this).prop("checked", true);
				$(".checkChild").prop("checked", true);
			} else {
				$(this).prop("checked", false);
				$(".checkChild").prop("checked", false);
			}
		});

		$('#pagediv').on('click','.btnTd',function () {
			var remindUrl = $(this).attr("remindUrl");
			var bodyId = $(this).attr("bodyId");
			window.open('<%=basePath%>'+encodeURI(remindUrl));
		})

		// 删除
		$('.pagediv').on('click', '.delete_a', function () {
			var bodyIds = '';
			if($("#pageTbody tr td input:checked").length==0){
				parent.layer.msg("<fmt:message code="sms.th.SelectLeastOneData" />",{icon:0});
				return;
			}
			$("#pageTbody tr td input:checked").each(function () {

				bodyIds+=$(this).attr("bodyId")+',';
			});
			$.ajax({
				type: "post",
				url: "<%=basePath%>sms/delete",
				dataType: 'JSON',
				data: {"bodyIds":bodyIds,"deleteFlag":"1",},
				success: function (res) {
					if(res.flag){
						parent.layer.msg("<fmt:message code="workflow.th.delsucess" />",{icon:1});
						pageObj.init();
//                        initPageList(function (pageCount) {
//                            initPagination(pageCount, data.pageSize);
//                        });
					}else{
						parent.layer.msg("<fmt:message code="lang.th.deleSucess" />",{icon:2});
					}
				}
			})
		});

		// 全部删除
		$('#operation').on("click",".delete_all",function () {
			parent.layer.confirm("您确定删除所有数据吗？",{
				btn: ['确定','取消'] //按钮
			}, function(){
				$.ajax({
					type: "post",
					url: "<%=basePath%>sms/delete",
					dataType: 'JSON',
					data: {"deleteFlag":"1",},
					success: function (res) {
						if(res.flag){
							parent.layer.msg("<fmt:message code="workflow.th.delsucess" />",{icon:1});
							pageObj.init();
//                            initPageList(function (pageCount) {
//                                initPagination(pageCount, data.pageSize);
//                            });
						}else{
							parent.layer.msg("<fmt:message code="lang.th.deleSucess" />",{icon:2});
						}
					}
				})
			});
		});

		// 标记为已读
		$('.pagediv').on('click', '.remind_a', function () {
			var bodyIds = '';
			if($("#pageTbody tr td input:checked").length==0){
				parent.layer.msg("<fmt:message code="sms.th.SelectLeastOneData" />",{icon:0});
				return;
			}
			$("#pageTbody tr td input:checked").each(function () {
				bodyIds+=$(this).attr("bodyId")+',';
			});
			$.ajax({
				type: "post",
				url: "<%=basePath%>sms/updateRemind",
				dataType: 'JSON',
				data: {"bodyIds":bodyIds,"remindFlag":"0",},
				success: function (res) {
					if(res.flag){
						parent.layer.msg("<fmt:message code="sms.th.MarkSuccess" />",{icon:1});
//                        initPageList(function (pageCount) {
//                            initPagination(pageCount, data.pageSize);
//                        });
						pageObj.init();
					}else{
						parent.layer.msg("<fmt:message code="sms.th.FlagFailure" />",{icon:2});
					}
				}
			})
		});

		// 全部标记为已读
		$('#operation').on("click",".remind_all",function () {

			$.ajax({
				type: "post",
				url: "<%=basePath%>sms/updateRemind",
				dataType: 'JSON',
				data: {"remindFlag":"0",},
				success: function (res) {
					if(res.flag){
						parent.layer.msg("<fmt:message code="sms.th.MarkSuccess" />",{icon:1});
						initPageList(function (pageCount) {
							initPagination(pageCount, data.pageSize);
						});
					}else{
						parent.layer.msg("<fmt:message code="sms.th.FlagFailure" />",{icon:2});
					}
				}
			})
		});

		// 删除所有已读
		$('#operation').on("click",".delete_allRead",function () {
			parent.layer.confirm("您确定删除所有已读数据吗？",{
				btn: ['确定','取消'] //按钮
			}, function(){
				$.ajax({
					type: "post",
					url: "<%=basePath%>sms/deleteByRemind",
					dataType: 'JSON',
					data:{"deleteType":"1"},
					success: function (res) {
						if(res.flag){
							parent.layer.msg("<fmt:message code="workflow.th.delsucess" />",{icon:1});
							initPageList(function (pageCount) {
								initPagination(pageCount, data.pageSize);
							});
						}else{
							parent.layer.msg("<fmt:message code="lang.th.deleSucess" />",{icon:2});
						}
					}
				})
			});
		});

		// 详情点击事件
		$('.contentTableBody').on('click', '.detail_a', function () {
			var remindUrl = $(this).attr("remindUrl");
			var bodyId = $(this).attr("bodyId");
			$.ajax({
				type: "post",
				url: "<%=basePath%>sms/setRead",
				dataType: 'JSON',
				data: {"bodyId":bodyId},
				success: function (res) {
				}
			})
			window.open('<%=basePath%>'+encodeURI(remindUrl));
		});

	});

	function kaifa() {
		parent.layer.msg("<fmt:message code="sup.th.UnderDevelopment" />", {icon: 1});
	}
</script>
</body>
</html>
